/*     */ package com.lmpop.trade.ti_custlink;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Ti_custlinkInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_custlinkInfo()
/*     */   {
/*  16 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  25 */     Ti_custlink ti_custlink = new Ti_custlink();
/*  26 */     ti_custlink.setLink_id(map.getString("link_id"));
/*  27 */     ti_custlink.setCust_id(map.getString("cust_id"));
/*  28 */     ti_custlink.setLink_name(map.getString("link_name"));
/*  29 */     ti_custlink.setLink_url(map.getString("link_url"));
/*  30 */     ti_custlink.setLink_no(map.getInt("link_no"));
/*  31 */     ti_custlink.setIs_display(map.getString("is_display"));
/*     */ 
/*  33 */     String result_code = "0";
/*     */     try {
/*  35 */       insert(dbmMgr, ti_custlink);
/*     */     } catch (ApplicationException e) {
/*  37 */       e.printStackTrace();
/*  38 */       result_code = "1";
/*     */     }
/*  40 */     map.setString("result_code", result_code);
/*  41 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_custlink ti_custlink)
/*     */     throws ApplicationException
/*     */   {
/*  50 */     dbmMgr.update("insertTi_custlink", ti_custlink);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  60 */     String pkid_string = map.getString("pkid");
/*  61 */     String result_code = "0";
/*     */     try {
/*  63 */       if (!pkid_string.equals("")) {
/*  64 */         String[] pkStr = pkid_string.split("\\|");
/*  65 */         for (int i = 0; i < pkStr.length; i++) {
/*  66 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  70 */       e.printStackTrace();
/*  71 */       result_code = "1";
/*     */     }
/*  73 */     map.setString("attach_root_id", pkid_string);
/*  74 */     map.setString("attach_sign", "delete");
/*  75 */     map.setString("result_code", result_code);
/*  76 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/*  85 */     dbmMgr.update("deleteTi_custlink", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  94 */     Ti_custlink ti_custlink = new Ti_custlink();
/*  95 */     ti_custlink.setLink_id(map.getString("link_id"));
/*  96 */     ti_custlink.setCust_id(map.getString("cust_id"));
/*  97 */     ti_custlink.setLink_name(map.getString("link_name"));
/*  98 */     ti_custlink.setLink_url(map.getString("link_url"));
/*  99 */     ti_custlink.setLink_no(map.getInt("link_no"));
/* 100 */     ti_custlink.setIs_display(map.getString("is_display"));
/*     */ 
/* 102 */     String result_code = "0";
/*     */     try {
/* 104 */       update(dbmMgr, ti_custlink);
/*     */     } catch (ApplicationException e) {
/* 106 */       e.printStackTrace();
/* 107 */       result_code = "1";
/*     */     }
/* 109 */     map.setString("result_code", result_code);
/* 110 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_custlink ti_custlink)
/*     */     throws ApplicationException
/*     */   {
/* 119 */     dbmMgr.update("updateTi_custlink", ti_custlink);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 129 */     Map ti_custlink = (Hashtable)obj;
/*     */ 
/* 131 */     if (start == 0)
/* 132 */       start = 0;
/*     */     else {
/* 134 */       start = (start - 1) * limit;
/*     */     }
/* 136 */     ti_custlink.put("start", Integer.valueOf(start));
/* 137 */     ti_custlink.put("limit", Integer.valueOf(limit));
/*     */ 
/* 139 */     return this.queryList.getList("getListByTi_custlinkPage", ti_custlink);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 150 */     Map ti_custlink = (Hashtable)obj;
/*     */ 
/* 152 */     List list = this.queryList.getList("getCountByObjTi_custlink", ti_custlink);
/* 153 */     int count = 0;
/* 154 */     if ((list != null) && (list.size() > 0)) {
/* 155 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 156 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 157 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 160 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 170 */     return this.queryList.getList("getTi_custlinkByPk", pk);
/*     */   }
/*     */ 
/*     */   public SysMap linkSort(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 176 */     Ti_custlink ti_link = new Ti_custlink();
/* 177 */     String pkid_string = map.getString("sort");
/* 178 */     String result_code = "0";
/*     */     try {
/* 180 */       if (!pkid_string.equals("")) {
/* 181 */         String[] pkStr = pkid_string.split("\\|");
/* 182 */         for (int i = 0; i < pkStr.length; i++)
/*     */         {
/* 184 */           if (pkStr[i].equals(""))
/*     */             continue;
/* 186 */           String[] sort = pkStr[i].split(",");
/* 187 */           if (sort.length == 1)
/*     */           {
/* 189 */             ti_link.setLink_id(sort[0]);
/* 190 */             ti_link.setLink_no(0);
/* 191 */             updateSort(dbmMgr, ti_link);
/*     */           }
/* 193 */           if (sort.length != 2)
/*     */             continue;
/* 195 */           ti_link.setLink_id(sort[0]);
/* 196 */           ti_link.setLink_no(Integer.parseInt(sort[1]));
/* 197 */           updateSort(dbmMgr, ti_link);
/*     */         }
/*     */       }
/*     */     }
/*     */     catch (ApplicationException e)
/*     */     {
/* 203 */       e.printStackTrace();
/* 204 */       result_code = "1";
/*     */     }
/* 206 */     map.setString("result_code", result_code);
/* 207 */     return map;
/*     */   }
/*     */ 
/*     */   public void updateSort(DbmInterf dbmMgr, Ti_custlink ti_link) throws ApplicationException {
/* 211 */     dbmMgr.update("updateTi_CustlinkSort", ti_link);
/*     */   }
/*     */ 
/*     */   public List getCustListByPage(Object obj, int start, int limit)
/*     */   {
/* 221 */     Map ti_custlink = (Hashtable)obj;
/*     */ 
/* 223 */     if (start == 0)
/* 224 */       start = 0;
/*     */     else {
/* 226 */       start = (start - 1) * limit;
/*     */     }
/* 228 */     ti_custlink.put("start", Integer.valueOf(start));
/* 229 */     ti_custlink.put("limit", Integer.valueOf(limit));
/* 230 */     return this.queryList.getList("getCustListByTi_custlinkPage", ti_custlink);
/*     */   }
/*     */ 
/*     */   public int getCustCountByObj(Object obj)
/*     */   {
/* 242 */     Map ti_custlink = (Hashtable)obj;
/* 243 */     List list = this.queryList.getList("getCustCountByObjTi_custlink", ti_custlink);
/* 244 */     int count = 0;
/* 245 */     if ((list != null) && (list.size() > 0)) {
/* 246 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 247 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 248 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 251 */     return count;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_custlink.Ti_custlinkInfo
 * JD-Core Version:    0.6.0
 */